import * as dayjs from "dayjs";

import { BaseFailureResponseVO, BaseSuccessResponseVO } from "../vo/base-response.vo";

class AjaxResult {
    public static success<T = any>(data: T = void 0, msg: string = "成功", code: number = 200) {
        return new BaseSuccessResponseVO(code, msg, data);
    }

    public static fail<T = any>(code: number = 300, msg: string = "失败", path?: string, error?: T) {
        return new BaseFailureResponseVO(code, msg, path, error, dayjs().format("YYYY-MM-DD HH:mm:ss"));
    }
}

export default AjaxResult;
